{% extends 'base_admin.html'%}
{% load static%}


{%block css %}
<link rel="stylesheet" href="{%static 'css/index.css'%}">
{%endblock%}
{% block active1 %}
active
{%endblock%}
{% block content%}
<div class="panel panel-default">
  <div class="panel-heading">
    <h3 class="panel-title">学生搜索</h3>
  </div>
  <div class="panel-body">
    <form method="post" class="form-inline" action="/student/query/">
        {%csrf_token%}
        <label for="">
            <select class="form-group form-control" name="school_name">
                    <option >--请选择学院--</option>
                {% for school in schools%}
                    {% if school_name == school.上课院系 %}
                        <option selected>{{school.上课院系}}</option>
                    {% else %}
                        <option>{{school.上课院系}}</option>
                    {% endif%}
                {% endfor %}
            </select>
        </label>
        <div class="form-group">
            <input type="text" class="form-control"  placeholder="学生姓名" name="name" value="{{name}}" autocomplete="off">
        </div>
        <div class="form-group">
            <input type="text" class="form-control"  placeholder="身份证号" name="car_no" value="{{car_no}}" autocomplete="off">
        </div>
        
        <button type="submit" class="btn btn-default">搜索</button>
        <a class="btn btn-default" href="/student/index">重置</a>

    </form>
  </div>
</div>
<table class="table table-striped">
    <thead>
        <tr>
            <td class="">学号</td>
            <td class="">姓名</td>
            <td class="">性别</td>
            <td class="">上课院系</td>
            <td class="">班级</td>
            <td class="">学制</td>
            <td class="">当前所在级</td>
            <td class="">身份证号码</td>
            <td class="">培养层次</td>
            <td class="">入学日期</td>
            <td class="">民族</td>
        </tr>
    </thead>
    {% for data in datas%}
    <tbody>
        <tr>
            <td class="">{{data.学号}}</td>
            <td class="">{{data.姓名}}</td>
            <td class="">{{data.性别}}</td>
            <td class="">{{data.上课院系}}</td>
            <td class="">{{data.班级}}</td>
            <td class="">{{data.学制}}</td>
            <td class="">{{data.当前所在级}}</td>
            <td class="">{{data.身份证件号}}</td>
            <td class="">{{data.培养层次}}</td>
            <td class="">{{data.入学日期}}</td>
            <td class="">{{data.民族}}</td>
        </tr>
    </tbody>
    {%endfor%}
</table>
<div class="to-page" >
    {% if datas.has_previous%}
        <a class="btn btn-primary btn-sm" href="/student/query?page=1">&laquo; 第一页</a>
        <a class="btn btn-primary btn-sm" href="/student/query/?pn={{datas.previous_page_number}}">上一页</a>
    {% else %}
        <a class="btn btn-primary btn-sm" href="/student/query/?page=1">&laquo; 第一页</a>
        <a class="btn btn-primary btn-sm" href="/student/query/?pn=1">上一页</a>
    {% endif %}
    {% if datas.has_next %}
        <a class="btn btn-primary btn-sm" href="/student/query/?pn={{ datas.next_page_number }}">下一页</a>
        <a class="btn btn-primary btn-sm" href="/student/query?pn={{ datas.paginator.num_pages }}">末页 &raquo;</a>
    {% else %}
        <a class="btn btn-primary btn-sm" href="/student/query/?pn={{ datas.paginator.num_pages }}">下一页</a>
        <a class="btn btn-primary btn-sm" href="/stunent/query/?pn={{ datas.paginator.num_pages }}">末页 &raquo;</a>
    {% endif %}
    <span class="pageinfo" >
          Page {{ datas.number }} of {{ datas.paginator.num_pages }} ; Title {{datas.paginator.count}}
    </span>
</div>
{% endblock %}